<template>
  <ych-modal
    :fullscreen="false"
    :title="title"
    :visible="visible"
    @ok="handleOk"
    @cancel="handleCancel"
    :cancelText="$t('m.common.button.close')">

    <process-def-list ref="container" :radio="radio"></process-def-list>

  </ych-modal>
</template>

<script>

  import ProcessDefList from './list/ProcessDefList';

  export default {
    name: "SelectResourceDialog",
    components: {
      ProcessDefList
    },
    data() {
      return {
        title: this.$t('m.bpm.other.xuan-ze-liu-cheng-mo-ban'),
        visible: false,
        radio: false,
      }
    },
    methods: {
      handleCancel() {
        this.visible = false;
        this.radio = false;
        this.$refs.container.selectedRowKeys = [];
        this.$refs.container.selectionRows = [];
      },
      handleOk() {
        if (this.$refs.container.selectedRowKeys.length == 0) {
          this.messageUtil.warning(this.$t('m.eform.formDesign.label.qing-xuan-ze-shu-ju'));
          return;
        }
        this.$emit("selectFinished", this.$refs.container.selectedRowKeys, this.$refs.container.selectionRows);
        this.handleCancel();
      }
    }
  }
</script>
